function [] = SavePolicy()
global keyword;
global home_path;

global blue;
global red;
global num_passes; 
global time;
global random;
global possession;
global total_reward;

global theta;
global epsilon;

global num_players_r

num_episodes = blue + red;
ratio = red/num_episodes;
time = time + toc;
tic % restart timer
passes_per_episode = num_passes/num_episodes;
time_per_episode = time/num_episodes;
possession_per_episode = possession/num_episodes;
random_per_episode = random/(num_players_r*num_episodes);
reward_per_episode = total_reward/(num_players_r*num_episodes);
parameters = theta;    

savefile = strcat(home_path,'policies/policy_',num2str(blue+red),'_',keyword,'.mat');
save(savefile, 'ratio','parameters','time','time_per_episode','random_per_episode','possession_per_episode','reward_per_episode','epsilon'); 
disp(sprintf('Saving intermediate policy: %s', savefile)); 

end
